/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			lydata.h
  \date			Sep 2012
  \author		TNick

  \brief		Contains the definition for LyData class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __LYDATA_INC__
#define __LYDATA_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<memtrack.h>
#include	<cpg/logic/characteristics/pgcolor.h>
#include	<cpg/logic/characteristics/pglnpattern.h>
#include	<cpg/logic/characteristics/pglnpattscale.h>
#include	<cpg/logic/characteristics/pglnwidth.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

namespace	cpg		{


/**
*	@brief	class that stores the properties of a layer
*
*	This structure is common to global and local layers. For an overview of
*	the layers see \ref layers "dedicated page".
*/
class LyData		: public MemTrack		{
	BBM_TRACK( LyData );

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

public:


	/**
	*	@brief	switches that apply to this class
	*/
	enum		Flags			{
		NO_FLAG = 0,

		IS_VISIBLE = 0x00000001,	/**< the user can see the layer on screen */
		IS_PRINTABLE = 0x00000002,	/**< layer is printed */
		IS_DELETED = 0x00000004,	/**< layer is not part of a chain */

		FLG_MAX
	};


	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

public:


	/**
	*	@brief	various switches
	*/
	Flags						flg_;


	/**
	*	@brief	name of this layer
	*/
	QString						s_name_;




	/**
	*	@brief	weight of the line
	*/
	PgLnWeight::Id				ln_weight_;


	/**
	*	@brief	scale of the pattern
	*/
	PgLnPattScale::Id			ln_scale_;


	/**
	*	@brief	the color to use
	*/
	PgColor::Id					color_;


	/**
	*	@brief	the line pattern to use
	*/
	PgLnPattern::Id				ln_patt_;



	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:


	/**
	*	@brief	constructor;
	*/
	LyData				( void ) : MemTrack() {}


	/**
	*	@brief	sets default values
	*/
	void					init				( void )
	{
		flg_ = (Flags)( IS_VISIBLE | IS_PRINTABLE );
		color_ = PgColor::FOREGROUND;
		ln_patt_ = PgLnPattern::SOLID;
		ln_weight_ = PgLnWeight::WEIGHT_SINGLE;
		ln_scale_ = PgLnPattScale::SCALE_1;
	}


	//!@{
	//!	@brief	on or off
	inline bool				isOn		( void ) const
	{ return isFlag( IS_VISIBLE ); }
	inline void				setOn		( void )
	{ setFlag( IS_VISIBLE ); }
	inline void				setOff		( void )
	{ resetFlag( IS_VISIBLE ); }
	inline void				toogleOn	( void )
	{ isOn() ? setOff() : setOn(); }
	inline void				changeOn	( bool b_val )
	{ b_val ? setOn() : setOff(); }
	//!@}


	//!@{
	//!	@brief	printable or not
	inline bool				isPrint		( void ) const
	{ return isFlag( IS_PRINTABLE ); }
	inline void				setPrint	( void )
	{ setFlag( IS_PRINTABLE ); }
	inline void				setNoPrint	( void )
	{ resetFlag( IS_PRINTABLE ); }
	inline void				tooglePrint	( void )
	{ isPrint() ? setNoPrint() : setPrint(); }
	inline void				changePrint	( bool b_val )
	{ b_val ? setPrint() : setNoPrint(); }
	//!@}


	//!@{
	//!	@brief	deleted or not
	inline bool				isDeleted		( void ) const
	{ return isFlag( IS_DELETED ); }
	inline void				setDeleted		( void )
	{ setFlag( IS_DELETED ); }
	inline void				setUndeleted	( void )
	{ resetFlag( IS_DELETED ); }
	inline void				toogleDeleted	( void )
	{ isDeleted() ? setUndeleted() : setDeleted(); }
	inline void				changeDeleted	( bool b_val )
	{ b_val ? setDeleted() : setUndeleted(); }
	//!@}

private:


	/// set (1) one of the boolean properties
	inline void		setFlag			( int new_flg )
	{ flg_ = static_cast<Flags> (flg_ | new_flg ); }


	/// reset (0) one of the boolean properties
	inline void		resetFlag		( int new_flg )
	{ flg_ = static_cast<Flags> (flg_ & (~new_flg )); }


	/// see if one boolean property is on or off
	inline bool		isFlag			( int new_flg ) const
	{ return (flg_ & new_flg ) != 0; }


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class LyData	*/

/*  CLASS    =============================================================== */
//
//
//
//

}	//	namespace	cpg

#endif // __LYDATA_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
